<?php

namespace app\common\event\user;

use app\logic\es\EsUser;

use think\facade\Log;

class EsImportUser
{

    public function handle($data)
    {
        config('app.env') != 'prod' && Log::channel('my')->info('[ EsImportUser ] ' . json_encode($data));

        if ($data['status'] == 1) {
            try {
                EsUser::getInstance()->import($data['user_id']);
            } catch (\Throwable $e) {
                Log::channel('my')->error('[ EsImportUser ] ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString());
                custom_log('发生错误:', ["Error" => $e->getMessage(), 'Trace' => $e->getTraceAsString()], 'EsImportUser.log');
            }
        }
    }
}